package com.chen.controller;

import com.chen.bean.User;
import com.chen.common.R;
import com.chen.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;
import java.util.Map;

@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;

    /**
     * 获取验证码
     * @param user
     * @return
     */
    @PostMapping("/sendMsg")
    public R<String> sendMsg(@RequestBody User user, HttpSession session){
        return userService.sendMsg(user,session);
    }

    /**
     * 登录验证
     * @param
     * @return
     */
    @PostMapping("/login")
    public R<String> login(@RequestBody Map<String,Object> map, HttpSession session){
        return userService.login(map,session);
    }


}
